home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Icons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  10.8 KB  |  302 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Icons.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __ICONS__
  18. #define __ICONS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __QUICKDRAW__
  27. #include <Quickdraw.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <QuickdrawText.h>                                    */
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. #if GENERATINGPOWERPC
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. #ifdef __CFM68K__
  41. #pragma lib_export on
  42. #endif
  43.  
  44.  
  45. enum {
  46. /* The following are icons for which there are both icon suites and SICNs. */
  47.     genericDocumentIconResource    = -4000,
  48.     genericStationeryIconResource = -3985,
  49.     genericEditionFileIconResource = -3989,
  50.     genericApplicationIconResource = -3996,
  51.     genericDeskAccessoryIconResource = -3991,
  52.     genericFolderIconResource    = -3999,
  53.     privateFolderIconResource    = -3994,
  54.     floppyIconResource            = -3998,
  55.     trashIconResource            = -3993,
  56. /* The following are icons for which there are SICNs only. */
  57.     desktopIconResource            = -3992,
  58.     openFolderIconResource        = -3997,
  59.     genericHardDiskIconResource    = -3995,
  60.     genericFileServerIconResource = -3972,
  61.     genericSuitcaseIconResource    = -3970,
  62.     genericMoverObjectIconResource = -3969,
  63. /* The following are icons for which there are icon suites only. */
  64.     genericPreferencesIconResource = -3971,
  65.     genericQueryDocumentIconResource = -16506,
  66.     genericExtensionIconResource = -16415,
  67.     systemFolderIconResource    = -3983,
  68.     appleMenuFolderIconResource    = -3982
  69. };
  70.  
  71. enum {
  72.     startupFolderIconResource    = -3981,
  73.     ownedFolderIconResource        = -3980,
  74.     dropFolderIconResource        = -3979,
  75.     sharedFolderIconResource    = -3978,
  76.     mountedFolderIconResource    = -3977,
  77.     controlPanelFolderIconResource = -3976,
  78.     printMonitorFolderIconResource = -3975,
  79.     preferencesFolderIconResource = -3974,
  80.     extensionsFolderIconResource = -3973,
  81.     fontsFolderIconResource        = -3968,
  82.     fullTrashIconResource        = -3984,
  83.     large1BitMask                = 'ICN#',
  84.     large4BitData                = 'icl4',
  85.     large8BitData                = 'icl8',
  86.     small1BitMask                = 'ics#',
  87.     small4BitData                = 'ics4',
  88.     small8BitData                = 'ics8',
  89.     mini1BitMask                = 'icm#',
  90.     mini4BitData                = 'icm4',
  91.     mini8BitData                = 'icm8'
  92. };
  93.  
  94. /*  alignment type values  */
  95. enum {
  96.     atNone                        = 0x0,
  97.     atVerticalCenter            = 0x1,
  98.     atTop                        = 0x2,
  99.     atBottom                    = 0x3,
  100.     atHorizontalCenter            = 0x4,
  101.     atAbsoluteCenter            = atVerticalCenter | atHorizontalCenter,
  102.     atCenterTop                    = atTop | atHorizontalCenter,
  103.     atCenterBottom                = atBottom | atHorizontalCenter,
  104.     atLeft                        = 0x8,
  105.     atCenterLeft                = atVerticalCenter | atLeft,
  106.     atTopLeft                    = atTop | atLeft,
  107.     atBottomLeft                = atBottom | atLeft,
  108.     atRight                        = 0xC,
  109.     atCenterRight                = atVerticalCenter | atRight,
  110.     atTopRight                    = atTop | atRight,
  111.     atBottomRight                = atBottom | atRight
  112. };
  113.  
  114. typedef short IconAlignmentType;
  115.  
  116. /*  transform type values  */
  117.  
  118. enum {
  119.     ttNone                        = 0x0,
  120.     ttDisabled                    = 0x1,
  121.     ttOffline                    = 0x2,
  122.     ttOpen                        = 0x3,
  123.     ttLabel1                    = 0x0100,
  124.     ttLabel2                    = 0x0200,
  125.     ttLabel3                    = 0x0300,
  126.     ttLabel4                    = 0x0400,
  127.     ttLabel5                    = 0x0500,
  128.     ttLabel6                    = 0x0600,
  129.     ttLabel7                    = 0x0700,
  130.     ttSelected                    = 0x4000,
  131.     ttSelectedDisabled            = ttSelected | ttDisabled,
  132.     ttSelectedOffline            = ttSelected | ttOffline,
  133.     ttSelectedOpen                = ttSelected | ttOpen
  134. };
  135.  
  136. typedef short IconTransformType;
  137.  
  138. /*  Selector mask values  */
  139.  
  140. enum {
  141.     svLarge1Bit                    = 0x00000001,
  142.     svLarge4Bit                    = 0x00000002,
  143.     svLarge8Bit                    = 0x00000004,
  144.     svSmall1Bit                    = 0x00000100,
  145.     svSmall4Bit                    = 0x00000200,
  146.     svSmall8Bit                    = 0x00000400,
  147.     svMini1Bit                    = 0x00010000,
  148.     svMini4Bit                    = 0x00020000,
  149.     svMini8Bit                    = 0x00040000,
  150.     svAllLargeData                = 0x000000ff,
  151.     svAllSmallData                = 0x0000ff00,
  152.     svAllMiniData                = 0x00ff0000,
  153.     svAll1BitData                = svLarge1Bit | svSmall1Bit | svMini1Bit,
  154.     svAll4BitData                = svLarge4Bit | svSmall4Bit | svMini4Bit,
  155.     svAll8BitData                = svLarge8Bit | svSmall8Bit | svMini8Bit,
  156.     svAllAvailableData            = 0xffffffffL
  157. };
  158.  
  159. typedef unsigned long IconSelectorValue;
  160.  
  161. typedef pascal OSErr (*IconActionProcPtr)(ResType theType, Handle *theIcon, void *yourDataPtr);
  162.  
  163. #if GENERATINGCFM
  164. typedef UniversalProcPtr IconActionUPP;
  165. #else
  166. typedef IconActionProcPtr IconActionUPP;
  167. #endif
  168.  
  169. enum {
  170.     uppIconActionProcInfo = kPascalStackBased
  171.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  172.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType)))
  173.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle*)))
  174.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void*)))
  175. };
  176.  
  177. #if GENERATINGCFM
  178. #define NewIconActionProc(userRoutine)        \
  179.         (IconActionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppIconActionProcInfo, GetCurrentArchitecture())
  180. #else
  181. #define NewIconActionProc(userRoutine)        \
  182.         ((IconActionUPP) (userRoutine))
  183. #endif
  184.  
  185. #if GENERATINGCFM
  186. #define CallIconActionProc(userRoutine, theType, theIcon, yourDataPtr)        \
  187.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppIconActionProcInfo, (theType), (theIcon), (yourDataPtr))
  188. #else
  189. #define CallIconActionProc(userRoutine, theType, theIcon, yourDataPtr)        \
  190.         (*(userRoutine))((theType), (theIcon), (yourDataPtr))
  191. #endif
  192.  
  193. typedef IconActionProcPtr IconAction;
  194.  
  195. typedef pascal Handle (*IconGetterProcPtr)(ResType theType, void *yourDataPtr);
  196.  
  197. #if GENERATINGCFM
  198. typedef UniversalProcPtr IconGetterUPP;
  199. #else
  200. typedef IconGetterProcPtr IconGetterUPP;
  201. #endif
  202.  
  203. enum {
  204.     uppIconGetterProcInfo = kPascalStackBased
  205.          | RESULT_SIZE(SIZE_CODE(sizeof(Handle)))
  206.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType)))
  207.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  208. };
  209.  
  210. #if GENERATINGCFM
  211. #define NewIconGetterProc(userRoutine)        \
  212.         (IconGetterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppIconGetterProcInfo, GetCurrentArchitecture())
  213. #else
  214. #define NewIconGetterProc(userRoutine)        \
  215.         ((IconGetterUPP) (userRoutine))
  216. #endif
  217.  
  218. #if GENERATINGCFM
  219. #define CallIconGetterProc(userRoutine, theType, yourDataPtr)        \
  220.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppIconGetterProcInfo, (theType), (yourDataPtr))
  221. #else
  222. #define CallIconGetterProc(userRoutine, theType, yourDataPtr)        \
  223.         (*(userRoutine))((theType), (yourDataPtr))
  224. #endif
  225.  
  226. typedef IconGetterProcPtr IconGetter;
  227.  
  228. extern pascal OSErr PlotIconID(const Rect *theRect, IconAlignmentType align, IconTransformType transform, short theResID)
  229.  THREEWORDINLINE(0x303C, 0x0500, 0xABC9);
  230. extern pascal OSErr NewIconSuite(Handle *theIconSuite)
  231.  THREEWORDINLINE(0x303C, 0x0207, 0xABC9);
  232. extern pascal OSErr AddIconToSuite(Handle theIconData, Handle theSuite, ResType theType)
  233.  THREEWORDINLINE(0x303C, 0x0608, 0xABC9);
  234. extern pascal OSErr GetIconFromSuite(Handle *theIconData, Handle theSuite, ResType theType)
  235.  THREEWORDINLINE(0x303C, 0x0609, 0xABC9);
  236. extern pascal OSErr ForEachIconDo(Handle theSuite, IconSelectorValue selector, IconActionUPP action, void *yourDataPtr)
  237.  THREEWORDINLINE(0x303C, 0x080A, 0xABC9);
  238. extern pascal OSErr GetIconSuite(Handle *theIconSuite, short theResID, IconSelectorValue selector)
  239.  THREEWORDINLINE(0x303C, 0x0501, 0xABC9);
  240. extern pascal OSErr DisposeIconSuite(Handle theIconSuite, Boolean disposeData)
  241.  THREEWORDINLINE(0x303C, 0x0302, 0xABC9);
  242. extern pascal OSErr PlotIconSuite(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIconSuite)
  243.  THREEWORDINLINE(0x303C, 0x0603, 0xABC9);
  244. extern pascal OSErr MakeIconCache(Handle *theHandle, IconGetterUPP makeIcon, void *yourDataPtr)
  245.  THREEWORDINLINE(0x303C, 0x0604, 0xABC9);
  246. extern pascal OSErr LoadIconCache(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIconCache)
  247.  THREEWORDINLINE(0x303C, 0x0606, 0xABC9);
  248. extern pascal OSErr PlotIconMethod(const Rect *theRect, IconAlignmentType align, IconTransformType transform, IconGetterUPP theMethod, void *yourDataPtr)
  249.  THREEWORDINLINE(0x303C, 0x0805, 0xABC9);
  250. extern pascal OSErr GetLabel(short labelNumber, RGBColor *labelColor, Str255 labelString)
  251.  THREEWORDINLINE(0x303C, 0x050B, 0xABC9);
  252. extern pascal Boolean PtInIconID(Point testPt, const Rect *iconRect, IconAlignmentType align, short iconID)
  253.  THREEWORDINLINE(0x303C, 0x060D, 0xABC9);
  254. extern pascal Boolean PtInIconSuite(Point testPt, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  255.  THREEWORDINLINE(0x303C, 0x070E, 0xABC9);
  256. extern pascal Boolean PtInIconMethod(Point testPt, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  257.  THREEWORDINLINE(0x303C, 0x090F, 0xABC9);
  258. extern pascal Boolean RectInIconID(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, short iconID)
  259.  THREEWORDINLINE(0x303C, 0x0610, 0xABC9);
  260. extern pascal Boolean RectInIconSuite(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  261.  THREEWORDINLINE(0x303C, 0x0711, 0xABC9);
  262. extern pascal Boolean RectInIconMethod(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  263.  THREEWORDINLINE(0x303C, 0x0912, 0xABC9);
  264. extern pascal OSErr IconIDToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, short iconID)
  265.  THREEWORDINLINE(0x303C, 0x0613, 0xABC9);
  266. extern pascal OSErr IconSuiteToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  267.  THREEWORDINLINE(0x303C, 0x0714, 0xABC9);
  268. extern pascal OSErr IconMethodToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  269.  THREEWORDINLINE(0x303C, 0x0915, 0xABC9);
  270. extern pascal OSErr SetSuiteLabel(Handle theSuite, short theLabel)
  271.  THREEWORDINLINE(0x303C, 0x0316, 0xABC9);
  272. extern pascal short GetSuiteLabel(Handle theSuite)
  273.  THREEWORDINLINE(0x303C, 0x0217, 0xABC9);
  274. extern pascal OSErr GetIconCacheData(Handle theCache, void **theData)
  275.  THREEWORDINLINE(0x303C, 0x0419, 0xABC9);
  276. extern pascal OSErr SetIconCacheData(Handle theCache, void *theData)
  277.  THREEWORDINLINE(0x303C, 0x041A, 0xABC9);
  278. extern pascal OSErr GetIconCacheProc(Handle theCache, IconGetterUPP *theProc)
  279.  THREEWORDINLINE(0x303C, 0x041B, 0xABC9);
  280. extern pascal OSErr SetIconCacheProc(Handle theCache, IconGetterUPP theProc)
  281.  THREEWORDINLINE(0x303C, 0x041C, 0xABC9);
  282. extern pascal OSErr PlotIconHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon)
  283.  THREEWORDINLINE(0x303C, 0x061D, 0xABC9);
  284. extern pascal OSErr PlotSICNHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN)
  285.  THREEWORDINLINE(0x303C, 0x061E, 0xABC9);
  286. extern pascal OSErr PlotCIconHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon)
  287.  THREEWORDINLINE(0x303C, 0x061F, 0xABC9);
  288.  
  289. #ifdef __CFM68K__
  290. #pragma lib_export off
  291. #endif
  292.  
  293. #if GENERATINGPOWERPC
  294. #pragma options align=reset
  295. #endif
  296.  
  297. #ifdef __cplusplus
  298. }
  299. #endif
  300.  
  301. #endif /* __ICONS__ */
  302.